import request from "@/utils/request";

const CUTTINGBEDDETAILS_BASE_URL = "/api/v1/cutting-bed-details";

const CuttingBedDetailsAPI = {
  /** 获取裁床明细分页数据 */
  getPage(queryParams?: CuttingBedDetailsPageQuery) {
    return request<any, PageResult<CuttingBedDetailsPageVO[]>>({
      url: `${CUTTINGBEDDETAILS_BASE_URL}/page`,
      method: "get",
      params: queryParams,
    });
  },
  /**
   * 获取裁床明细表单数据
   *
   * @param id 裁床明细ID
   * @returns 裁床明细表单数据
   */
  getFormData(id: number) {
    return request<any, CuttingBedDetailsForm>({
      url: `${CUTTINGBEDDETAILS_BASE_URL}/${id}/form`,
      method: "get",
    });
  },

  /**
   *  添加裁床明细
   *
   *  @param data 裁床明细表单数据
   */
  add(data: CuttingBedDetailsForm) {
    return request({
      url: `${CUTTINGBEDDETAILS_BASE_URL}`,
      method: "post",
      data,
    });
  },

  /**
   * 更新裁床明细
   *
   * @param id 裁床明细ID
   * @param data 裁床明细表单数据
   */
  update(id: number, data: CuttingBedDetailsForm) {
    return request({
      url: `${CUTTINGBEDDETAILS_BASE_URL}/${id}`,
      method: "put",
      data,
    });
  },

  /**
   * 批量删除裁床明细，多个以英文逗号(,)分割
   *
   * @param ids 裁床明细ID字符串，多个以英文逗号(,)分割
   */
  deleteByIds(ids: string) {
    return request({
      url: `${CUTTINGBEDDETAILS_BASE_URL}/${ids}`,
      method: "delete",
    });
  },
};

export default CuttingBedDetailsAPI;

/** 裁床明细分页查询参数 */
export interface CuttingBedDetailsPageQuery extends PageQuery {}

/** 裁床明细表单对象 */
export interface CuttingBedDetailsForm {
  id?: number;
  packageNumber?: string;
  color?: string;
  size?: string;
  cuttingQuantity?: number;
  orderQuantity?: number;
  cuttingBedId?: string;
  /** 创建时间 */
  createTime?: Date;
  /** 创建人ID */
  createBy?: number;
  /** 修改人ID */
  updateBy?: number;
  /** 更新时间 */
  updateTime?: Date;
}

/** 裁床明细分页对象 */
export interface CuttingBedDetailsPageVO {
  id?: number;
  packageNumber?: string;
  color?: string;
  size?: string;
  cuttingQuantity?: number;
  orderQuantity?: number;
  cuttingBedId?: string;
  /** 创建时间 */
  createTime?: Date;
  /** 创建人ID */
  createBy?: number;
  /** 修改人ID */
  updateBy?: number;
  /** 更新时间 */
  updateTime?: Date;
}
